#include <QtCore/QCryptographicHash>
#include "QpwLoginDialog.h"

QpwLoginDialog::QpwLoginDialog( QWidget * parent ) : QDialog(parent) {

    setupUi(this);

}

QpwLoginDialog::~QpwLoginDialog() {
}

QHostAddress QpwLoginDialog::host() const {

    return QHostAddress( serverEdit->currentText() );
}

QString QpwLoginDialog::username() const {

    return loginEdit->text();
}

QString QpwLoginDialog::passwordHash() const {

    QString pswd = passwordEdit->text();

    return pswd.count()
        ? QCryptographicHash::hash( pswd.toAscii(), QCryptographicHash::Md5 ).toHex()
        : QString()
    ;
}

int QpwLoginDialog::exec() {

    passwordEdit->setText("");

    return QDialog::exec();
}
